//所有的网络请求封装成方法

import axios from "../utils/request";
//将网络的请求封装成一个方法
const api = {


  //首页分页获取文章信息
    selectLimit(param){
        return axios.get("/writings/selectLimit/"+param)
    },
 //头部搜索框查询
    fuzzyQueries(param){
      return axios.get("/writings/fuzzyQueries/"+param)
    },
    //分页查询文章评论
    articleComments(param){
      return axios.post("/comments/articleComments",param)
    },
    //查询单篇文章
    saveEssayAll(param){
      return axios.get("/writings/save/"+param)
    },
    //查询单篇文章
    getByTitle(param){
        return axios.get("/writings/getByTitle/"+param)
    },

    //登录账户
   login(param){
       return axios.post("/front/userLogin",param)
   },
    //获取注销验证码
    deleteAutoCaptcha(param){
        return axios.get("/front/deleteAuto/captcha/"+param)
    },
    //注销账户
    deleteAuto(param){
        return axios.post("/userInformation/deleteAuto",param)
    },
    //获取登录验证码
    loginCaptcha(){
        return axios.get("/front/captcha")
    },
    //注册发送验证码
    enrollCaptcha(param){
        return axios.post("/userInformation/enroll/captcha",param)
    },
    //
    recoverThePassword(param){
        return axios.post("/userInformation/recover/pas",param)
    },
    // 删除验证码
    deleteCaptcha(param){
        return axios.get("/front/delete/captcha/"+param)
    },

    //注册
    enroll(param){
        return axios.post("/userInformation/enroll",param)
    },
    //退出登录
    logout(){
        return axios.get("/front/user/logout")
    },
    //查文章的用户信息
    saveUserInfo(param){
        return axios.get("/userInformation/save/"+param)
    },
    //查文章的用户信息
    getByID(param){
        return axios.get("/userInformation/getByID/"+param)
    },
    //获取消息发送者信息
    saveSenderInfo(param){
        return axios.get("/userInformation/save/senderInfo/"+param)
    },

    //获取消息发送者信息
    saveEssayUserInfo(param){
        return axios.get("/userInformation/save/essayInfo/"+param)
    },
    //查用户最近发布的前五条文章
    saveUserFives(param){
      return axios.get("/writings/saveUserFive/"+param);
    },
   //猜你喜欢
    getGuessYouLike(){
      return axios.get("/writings/guessyoulike");
    },

    //最佳热门
    getRecentlyHot(){
        return axios.get("/writings/guessyoulike");
    },

    //获取信息总数
    communicationGetSum(){
        return axios.get("/communication/messageReadSum");
    },
    //检查是否有信息，有则获取
    communicationGet(param){
      return axios.get("/communication/infoGet/"+param);
    },
    //发送消息
    communicationSet(param){
        return axios.post("/communication/infoSet",param);
    },
    //获取用户所有的信息
    communicationUserInfo(){
       return axios.get("/communication/userInfo")
    },
    //添加评论
    addComments(param){
      return axios.post("/comments/addComments",param)
    },
    //删除用户id
    delComments(param){
      return axios.delete("/comments/del/"+param)
    },
    //用户的总评论
    commentsGetAll(param){
      return axios.get("/comments/commentsGetAll/"+param)
    },
    //用户的总赞数
    supportGetAll(param){
        return axios.get("/writings/supportGetAll/"+param)
    },
    //用户的总浏览
    browseGetAll(param){
        return axios.get("/writings/browseGetAll/"+param)
    },
    //文章浏览增加减少
    browseAdd(param){
      return axios.get("/writings/browseAdd/"+param)
    },
    //文章的总评论
    commentsWritingsGetAll(param){
        return axios.get("/comments/commentsWritingsGetAll/"+param)
    },
    //文章赞增加减少
    supportAdd(param){
        return axios.post("/writings/supportAdd",param)
    },
    //检查文章点赞状态
    supportStatue(param){
        return axios.post("/writings/supportStatue",param)
    },
    //修改文章点赞状态
    supportChoose(param){
        return axios.post("/writings/supportChoose",param)
    },
    //新增文章
    writingsNew(param){
        return axios({
            url:"/writings/writingsAdd",
            method:"post",
            data:param,
            headers: {
                'Content-Type':'multipart/form-data'
            },
        })
},
    //更新文章
    writingsUpdate(param){
        return axios({
            url:"/writings/update",
            method:"post",
            data:param,
            headers:{
                'Content-Type':'multipart/form-data'
            }
        })
    },
    //删除文章
    writingsDel(param){
        return axios.delete("/writings/writingsDel/"+param)
    },



    //获取用户所有的文章
    getUserWritingsAll(param){
        return axios.get("/writings/getUserAll/"+param)
    },
    //用户信息更新
    updateUserInfo(param){
        return axios.post("/userInformation/updateUserInfo",param)
    },
    //上传用户头像
    uploadUserHeader(param){
      return axios({
          url:"/userInformation/uploadImage/heard",
          method:"post",
          data:param,
          headers:{
              'Content-Type':'multipart/form-data'
          }
      })
    },
    //消息已读
    messageRead(param){
      return axios.put("/communication/messageRead/"+param)
   },
    //消息删除
    messageDel(param){
        return axios.delete("/communication/messageDel/"+param)
    },
    //图片分类获取(分类获取)
    pictureGetType(param){
        return axios.post("/picture/getAll/type",param)
    },
    //图片分类获取(获取图片的分类)
    pictureType(){
        return axios.get("/picture/getType")
    },
    //分页获取祝福
    loveGet(param){
      return axios.get("/love/getAll/"+param)
    },
    //新增祝福
    loveInsert(param){
        return axios.post("/love/insert",param)
    },
    //获取恋爱事项
    loveListGet(){
      return axios.get("/loveList/getAll")
    },
    //获取所有的留言板信息
    MessageGet(param){
        return axios.get("/message/getAll/"+param)
    },

    //新增留言板信息
    MessageInsert(param){
        return axios.post("/message/insert",param)
    },

    //新增签到
    signInInsert(param){
      return axios.post("/signIn/insert",param)
    },
    //获取用户签到的日期
    signInGetAll(param){
       return axios.get("/signIn/getAll/"+param)
    },
    //获取用户的积分
    integralAdd(){
        return axios.get("/signIn/integralAdd")
    },
    //获取网站配置内容
    getAdminWeb(){
        return axios.get("/websiteAdministration/getAll")
    },
    //获取公告内容
    getAnnouncement(param){
        return axios.get("/announcement/getAllAnnouncement/"+param)
    },
    //获取琐事
    getTrivia(){
        return axios.get("/trivia/getAll");
    },
    //获取网站访问总次数
    webLength() {
        return axios.get("/websiteAdministration/length")
    },
    //获取网站访问总次数
    addWebLength() {
        return axios.get("/websiteAdministration/addLength")
    },

}
export default api